package cn.fate.core.common;

import java.util.HashMap;
import java.util.Map;

/**
 * @program: FtCore
 * @description:
 * @author: xubo
 * @create: 2021-09-13 17:39
 **/
public class ReturnCode {
    // 定义返回码及描述
    public static Map<String, String> returnCodeMap = new HashMap<>();

    /**
     * 系统类1开头
     */
    public static final String OK_AUTH = "10001";// 登陆成功
    public static final String NO_AUTH = "10002";// 交互会话已过期（TOKEN）
    public static final String LOGOUT_AUTH = "10003";// 退出成功
    public static final String USER_ERROR = "10004";// 帐号或密码错误
    public static final String SYSTEM_ERROR = "10005";// 系统错误
    public static final String PARAM_ERROR = "10006";// 参数错误
    public static final String SYSTEM_PATH_NOEXIST = "10007";// 路径不存在
    public static final String PASSWORD_ERROR = "10008";// 旧密码错误
    public static final String PASSWORD_EMPTYS = "10009";// 密码不能为空
    public static final String LOGIN_DEVICE_ERROR = "10010";// 同一设备不能同时登录
    public static final String OK_OFFLINE = "10011";// 强制下线成功
    public static final String APPID_NOEXIST = "10012";// AppId不存在
    public static final String TOKEN_ERROR = "10013";// Token验证失败
    public static final String NEWPWD_ISOLDPWD = "10014";// 新密码与旧密码相同

    /**
     * DB操作类 2开头
     */
    public static final String SAVE_SUCCESS = "20001";// 保存成功
    public static final String SAVE_FAILURE = "20002"; // 保存失败
    public static final String GET_SUCCESS = "20003";// 获取成功
    public static final String GET_FAILURE = "20004";// 获取失败
    public static final String DEL_SUCCESS = "20005";// 删除成功
    public static final String DEL_FAILURE = "20006";// 删除失败

    static {
        // 系统类
        returnCodeMap.put(ReturnCode.RSP_SUCCESS, "成功");
        returnCodeMap.put(ReturnCode.RSP_FAIL, "失败");
        returnCodeMap.put(ReturnCode.OK_AUTH, "登录成功");
        returnCodeMap.put(ReturnCode.NO_AUTH, "交互会话已过期,请重新登录");
        returnCodeMap.put(ReturnCode.LOGOUT_AUTH, "退出成功");
        returnCodeMap.put(ReturnCode.USER_ERROR, "账号或密码错误");
        returnCodeMap.put(ReturnCode.SYSTEM_ERROR, "系统错误");
        returnCodeMap.put(ReturnCode.PARAM_ERROR, "参数错误");
        returnCodeMap.put(ReturnCode.SYSTEM_PATH_NOEXIST, "路径不存在");
        returnCodeMap.put(ReturnCode.PASSWORD_ERROR, "旧密码错误");
        returnCodeMap.put(ReturnCode.PASSWORD_EMPTYS, "密码不能为空");
        returnCodeMap.put(ReturnCode.LOGIN_DEVICE_ERROR, "同一设备不能同时登录");
        returnCodeMap.put(ReturnCode.OK_OFFLINE, "强制下线成功");
        returnCodeMap.put(ReturnCode.APPID_NOEXIST, "AppId不存在");
        returnCodeMap.put(ReturnCode.TOKEN_ERROR, "Token验证失败");
        returnCodeMap.put(ReturnCode.NEWPWD_ISOLDPWD, "您输入的新密码与旧密码相同,无法修改!");

        // DB类
        returnCodeMap.put(ReturnCode.SAVE_SUCCESS, "保存成功");
        returnCodeMap.put(ReturnCode.SAVE_FAILURE, "保存失败");
        returnCodeMap.put(ReturnCode.GET_SUCCESS, "获取成功");
        returnCodeMap.put(ReturnCode.GET_FAILURE, "获取失败");
        returnCodeMap.put(ReturnCode.DEL_SUCCESS, "删除成功");
        returnCodeMap.put(ReturnCode.DEL_FAILURE, "删除失败");
    }

    // 响应成功返回码
    public static final String RSP_SUCCESS = "00";// 成功
    public static final String RSP_FAIL = "01";// 失败
    public static final String RSP_BUS_ERROR = "10000";//自定义业务错误
}
